// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package pica.core;

import c;
import java.io.*;
import java.util.Date;
import java.util.Vector;
import javax.microedition.rms.RecordStore;
import pica.ui.f;

// Referenced classes of package pica.core:
//            b, f, g

public final class d
{

    public d()
    {
        c = new b(this);
    }

    final void a(int i1, Object obj)
    {
        b.b(i1, obj);
    }

    public final void a(c c1)
    {
        b = c1;
    }

    public final b a()
    {
        return c;
    }

    public final boolean a(String s, String s1, String s2, String s3, boolean flag, boolean flag1, byte byte0)
    {
        String s4 = null;
        if(s == null || s.length() == 0)
            s4 = "PICA\u53F7\u4E0D\u80FD\u4E3A\u7A7A\uFF01";
        else
        if(s1 == null || s1.length() == 0)
            s4 = "\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01";
        if(s4 != null)
        {
            a(0, s4);
            return false;
        } else
        {
            c.a = s;
            c.b = s1;
            c.c = s2;
            c.d = s3;
            c.g = flag;
            c.f = flag1;
            a = new g(this);
            a.a(byte0);
            return true;
        }
    }

    public final void b()
    {
        a(c.a, c.b, c.c, c.d, !c.g, c.f, c.i);
    }

    public final void c()
    {
        a.f();
    }

    public final boolean a(String s, String s1, String s2, String s3)
    {
        String s4 = null;
        if(s.length() == 0)
            s4 = "\u53D1\u9001\u6D88\u606F\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s.length() > 255)
            s4 = "\u6D88\u606F\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E 255 \u4E2A\u5B57\u7B26\u3002";
        if(s4 != null)
        {
            a(0, s4);
            return false;
        }
        a.a(s1, "", s, "", "", s2, s3);
        String s5 = null;
        Object aobj[];
        if((aobj = c.a(s1)) != null)
            s5 = (String)aobj[4];
        else
        if(s1.equals("freesms.pica"))
            s5 = "PICA\u77ED\u4FE1";
        else
        if(s1.indexOf("@") > 0)
            s5 = s1.substring(0, s1.indexOf("@"));
        else
        if(s1.endsWith("pica"))
            s5 = "\u7CFB\u7EDF\u6D88\u606F";
        Object aobj1[] = {
            new Byte((byte)3), new Integer(-1), s1, s5, "", "", "", s, "", new Date(), 
            new Byte((byte)2), null, null, null, s2, s3, null
        };
        c.q().a(aobj1, false);
        c.c(aobj1);
        a(46, ((Object) (aobj1)));
        return true;
    }

    public final void a(String s, String s1, String s2)
    {
        Object aobj[] = {
            new Byte((byte)3), new Integer(-1), s, s1, "", "", "", s2, "", new Date(), 
            new Byte((byte)2), null, null, null, null, null, null
        };
        c.m().a(aobj, false);
        a.a(s, "", s2, "", "", "", "");
        a(5, ((Object) (aobj)));
    }

    public final int d()
    {
        return a.f;
    }

    public final void a(String s, String s1)
    {
        a.j(s, s1);
    }

    public final boolean a(String s)
    {
        String s1 = null;
        if(s.length() == 0)
            s1 = "\u53D1\u9001\u6D88\u606F\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s.length() > 255)
            s1 = "\u6D88\u606F\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E 255 \u4E2A\u5B57\u7B26\u3002";
        if(s1 != null)
        {
            a(0, s1);
            return false;
        } else
        {
            b b1 = a();
            Object aobj[] = {
                new Byte((byte)3), new Integer(-1), b1.a + "%" + b1.B, null, null, "groupchat", null, s, null, new Date(), 
                new Byte((byte)0), null, null, null
            };
            c.p().addElement(((Object) (aobj)));
            a(44, ((Object) (aobj)));
            a.c(c.B, "groupchat", s);
            return true;
        }
    }

    public final boolean b(String s, String s1, String s2)
    {
        String s3 = null;
        if(s2.length() == 0)
            s3 = "\u53D1\u9001\u6D88\u606F\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s2.length() > 255)
            s3 = "\u6D88\u606F\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E 255 \u4E2A\u5B57\u7B26\u3002";
        if(s3 != null)
        {
            a(0, s3);
            return false;
        } else
        {
            b b1 = a();
            Object aobj[] = {
                new Byte((byte)3), new Integer(-1), b1.a + "%" + b1.B, null, null, "chat", null, s2, null, new Date(), 
                new Byte((byte)2), null, null, s1
            };
            c.p().addElement(((Object) (aobj)));
            a(44, ((Object) (aobj)));
            a.b(s, "chat", s2);
            return true;
        }
    }

    public final void b(String s, String s1)
    {
        a.j(s, s1);
    }

    public final boolean c(String s, String s1)
    {
        String s2 = null;
        if(s1.length() == 0)
            s2 = "\u7EC4\u540D\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s1.equals("\u6211\u7684\u597D\u53CB") || s1.equals("\u9ED1\u540D\u5355") || s1.equals("\u964C\u751F\u4EBA"))
            s2 = "\u4E0D\u80FD\u4F7F\u7528\u7CFB\u7EDF\u5206\u7EC4\u540D\uFF01";
        else
        if(c.y().a(s1, (byte)4) != null)
            s2 = "\u8BE5\u5206\u7EC4\u5DF2\u5B58\u5728\uFF01";
        else
        if(s1.length() > 10)
            s2 = "\u7EC4\u540D\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26\uFF01";
          goto _L1
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
_L1:
        if(s2 != null)
        {
            a(0, s2);
            return false;
        } else
        {
            a.e(s, s1);
            return true;
        }
    }

    public final void e()
    {
        a.a(null, null, true, null, null, null);
    }

    public final boolean a(boolean flag, String s, String s1, String s2)
    {
        String s3 = null;
        if(s2.length() == 0)
            s3 = "\u5E74\u9F84\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        try
        {
            if(Integer.parseInt(s2) < 15)
                s2 = "15";
            else
            if(Integer.parseInt(s2) > 94)
                s2 = "94";
        }
        catch(Exception _ex)
        {
            s3 = "\u5E74\u9F84\u683C\u5F0F\u4E0D\u6B63\u786E\u3002";
        }
        if(s3 != null)
        {
            a(0, s3);
            return false;
        } else
        {
            String s4 = (Integer.parseInt(s2) - 5) + "-" + (Integer.parseInt(s2) + 5);
            a.a(null, null, flag, s1, s4, s);
            return true;
        }
    }

    public final void b(String s)
    {
        c.d(s);
        a.f("available", null);
    }

    public final boolean a(String s, String s1, String s2, String s3, String s4, String s5, String s6)
    {
        String s7 = null;
        if(s1 == null || s1.equals(""))
            s7 = "\u535A\u5BA2\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A.";
        else
        if(s2 == null || s2.equals(""))
            s7 = "\u535A\u5BA2\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A.";
        if(s7 != null)
        {
            a(0, s7);
            return false;
        } else
        {
            a.b(s, s1, s2, s3, s4, s5, s6);
            return true;
        }
    }

    public final boolean d(String s, String s1)
    {
        String s2 = null;
        if(s.length() == 0 || s1.length() == 0)
            s2 = "\u597D\u53CB\u624B\u673A\u53F7\u548C\u60A8\u7684\u59D3\u540D\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        if(s.startsWith("86"))
            s = s.substring(s.indexOf("86") + 2);
        else
        if(!s.startsWith("1") || s.length() > 12)
            s2 = "\u4E0D\u5408\u6CD5\u7684\u624B\u673A\u53F7\u7801";
        if(s2 != null)
        {
            a(0, s2);
            return false;
        } else
        {
            s = s + "@sms.pica";
            a.d(s, s1);
            return true;
        }
    }

    public final boolean c(String s, String s1, String s2)
    {
        String s3 = null;
        if(s.length() == 0 || s.equals("@pica"))
            s3 = "PICA\u53F7\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        if(s3 != null)
        {
            a(0, s3);
            return false;
        } else
        {
            a.a(s, null, s2, null);
            a.a(s, "subscribe", null, s1, 0);
            return true;
        }
    }

    public final boolean d(String s, String s1, String s2)
    {
        String s3 = null;
        if(s2.length() == 0)
            s3 = "\u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s2.length() > 10)
            s3 = "\u6635\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26\u3002";
        if(s3 != null)
        {
            a(0, s3);
            return false;
        } else
        {
            a.a(s, s2, s1, null);
            return true;
        }
    }

    public final void c(String s)
    {
        a.g(s);
    }

    public final boolean e(String s, String s1)
    {
        String s2 = null;
        if(s1.length() == 0)
            s2 = "\u5206\u7EC4\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s1.length() > 10)
            s2 = "\u5206\u7EC4\u540D\u79F0\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26\u3002";
        else
        if(s1.equals("\u9ED1\u540D\u5355") || s1.equals("\u964C\u751F\u4EBA"))
            s2 = "\u4E0D\u80FD\u4F7F\u7528\u7CFB\u7EDF\u5206\u7EC4\u540D\uFF01";
        if(s2 != null)
        {
            a(0, s2);
            return false;
        } else
        {
            a.a(s, null, s1, null);
            return true;
        }
    }

    public final void d(String s)
    {
        a.f("unavailable", s);
        a.a(s, "unsubscribe", null, null, 0);
        a.c(s);
    }

    public final void e(String s)
    {
        a.f("unavailable", s);
        a.c(s);
    }

    public final void f(String s)
    {
        a.d(s);
    }

    public final void g(String s)
    {
        a.d(s);
        c(s, "\u4F60\u597D\uFF01", "\u6211\u7684\u597D\u53CB");
    }

    public final void h(String s)
    {
        a.a(s, "unsubscribe", null, null, 0);
    }

    public final void f()
    {
        a.d();
    }

    public final void g()
    {
        a.c();
    }

    public final void f(String s, String s1)
    {
        a.b(s, s1);
        c.B = s;
        c.E = true;
    }

    public final void g(String s, String s1)
    {
        a.g(s, s1);
    }

    public final void i(String s)
    {
        a.e(s);
        c.B = s;
        c.E = true;
    }

    public final void h()
    {
        if(c.B != null && c.C != null)
            a.a(c.B, c.C);
        c.B = null;
        c.C = null;
    }

    public final void i()
    {
        if(c.B != null)
            a.f(c.B);
        c.B = null;
    }

    public final void j()
    {
        a.e();
    }

    public final void j(String s)
    {
        if(c.B != null)
            a.j(c.B);
        c.B = s;
        a.c(s, "enter");
        c.E = false;
    }

    public final void k()
    {
        a.j(c.B);
    }

    public final void k(String s)
    {
        a.g(s, "none");
    }

    public final void e(String s, String s1, String s2)
    {
        a.a(s, s2, s1);
    }

    public final boolean a(String s, String s1, String s2, String s3, String s4)
    {
        String s5 = null;
        if(s.length() == 0)
            s5 = "\u60A8\u8F93\u5165\u7684\u7FA4\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002";
        else
        if(s.length() > 10)
            s5 = "\u7FA4\u540D\u79F0\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26";
        else
        if(s4.length() > 255)
            s5 = "\u7FA4\u63CF\u8FF0\u4E0D\u80FD\u8D85\u51FA 255\u4E2A\u5B57\u7B26";
        if(s5 != null)
        {
            a(0, s5);
            return false;
        } else
        {
            a.a(s, s1, s2, s3, s4);
            return true;
        }
    }

    public final void l()
    {
        a.g();
    }

    public final void l(String s)
    {
        a.i(s);
    }

    public final boolean f(String s, String s1, String s2)
    {
        String s3 = null;
        if(s.length() == 0)
            s3 = "\u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        if(s3 != null)
        {
            a(0, s3);
            return false;
        } else
        {
            a.d(s1, s, s2);
            return true;
        }
    }

    public final void m(String s)
    {
        a.g(s);
    }

    public final void n(String s)
    {
        b b1 = a();
        Object aobj[] = {
            new Byte((byte)3), new Integer(-1), b1.a + "%" + b1.B, null, null, "groupchat", null, s, null, new Date(), 
            new Byte((byte)2), null, null, null
        };
        c.p().addElement(((Object) (aobj)));
        a(44, ((Object) (aobj)));
        a.c(c.B, "groupchat", s);
    }

    public final boolean a(String s, String s1, String s2, String s3, String s4, String s5)
    {
        String s6 = null;
        if(s1.length() == 0)
            s6 = "\u60A8\u8F93\u5165\u7684\u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002";
        else
        if(s5.length() > 255)
            s6 = "\u7FA4\u63CF\u8FF0\u4E0D\u80FD\u8D85\u51FA 255\u4E2A\u5B57\u7B26";
        if(s6 != null)
        {
            a(0, s6);
            return false;
        } else
        {
            a.a(s, s1, s2, s3, s4, s5);
            return true;
        }
    }

    public final boolean b(String s, String s1, String s2, String s3, String s4)
    {
        String s5 = null;
        if(s.length() == 0)
            s5 = "\u60A8\u8F93\u5165\u7684\u7FA4\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002";
        else
        if(s.length() > 10)
            s5 = "\u7FA4\u540D\u79F0\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26";
        else
        if(s4.length() > 255)
            s5 = "\u7FA4\u63CF\u8FF0\u4E0D\u80FD\u8D85\u51FA 255\u4E2A\u5B57\u7B26";
        if(s5 != null)
        {
            a(0, s5);
            return false;
        } else
        {
            a.c(c.B, s, s1, c.a + "@pica", s2, s4, s3);
            return true;
        }
    }

    public final boolean o(String s)
    {
        String s1 = null;
        if(s.length() == 0)
            s1 = "\u60A8\u8F93\u5165\u7684\u516C\u544A\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165\u3002";
        else
        if(s.length() > 255)
            s1 = "\u516C\u544A\u957F\u5EA6\u4E0D\u80FD\u8D85\u51FA 255 \u4E2A\u5B57\u7B26";
        if(s1 != null)
        {
            a(0, s1);
            return false;
        } else
        {
            a.k(s);
            return true;
        }
    }

    public final void h(String s, String s1)
    {
        a.i(s, s1);
    }

    public final boolean i(String s, String s1)
    {
        String s2 = null;
        if(s1.length() > 50)
            s2 = "\u5185\u5BB9\u4E0D\u80FD\u8D85\u51FA 50\u4E2A\u5B57\u7B26\u3002";
        if(s2 != null)
        {
            a(0, s2);
            return false;
        } else
        {
            a.a(s, s1, 0);
            return true;
        }
    }

    public final boolean j(String s, String s1)
    {
        String s2 = null;
        if(s1.length() > 50)
            s2 = "\u5185\u5BB9\u4E0D\u80FD\u8D85\u51FA 50\u4E2A\u5B57\u7B26\u3002";
        if(s2 != null)
        {
            a(0, s2);
            return false;
        } else
        {
            a.a(s, s1, 1);
            return true;
        }
    }

    public final boolean a(String s, String s1, String s2, int i1, String s3, String s4)
    {
        String s5 = null;
        if(s.length() == 0)
            s5 = "\u6635\u79F0\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s.length() > 10)
            s5 = "\u6635\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u51FA 10 \u4E2A\u5B57\u7B26\u3002";
        else
        if(s2.length() == 0)
            s5 = "\u5E74\u9F84\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        else
        if(s4.length() > 60)
            s5 = "\u4E2A\u4EBA\u63CF\u8FF0\u4E0D\u80FD\u8D85\u51FA 60 \u4E2A\u5B57\u7B26";
        if(s5 != null)
        {
            a(0, s5);
            return false;
        } else
        {
            a.a(c.a + "@pica", s, s3, s1, s2, i1, s4);
            return true;
        }
    }

    public final boolean p(String s)
    {
        String s1 = null;
        if(s.length() == 0)
        {
            s1 = "\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        } else
        {
            int i1 = s.length();
            int j1 = 0;
            do
            {
                if(j1 >= i1)
                    break;
                char c1;
                if(((c1 = s.charAt(j1)) < '0' || c1 > '9') && (c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z') && c1 != '_')
                {
                    s1 = "\u8F93\u5165\u7684\u5BC6\u7801\u6709\u975E\u6CD5\u5B57\u7B26\u3002";
                    break;
                }
                j1++;
            } while(true);
        }
        if(s1 != null)
        {
            a(0, s1);
            return false;
        } else
        {
            a.h(s);
            return true;
        }
    }

    public final void a(boolean flag, int i1)
    {
        c.h = flag;
        c.j = (byte)i1;
        p();
    }

    public final boolean k(String s, String s1)
    {
        c.a = s;
        c.b = s1;
        p();
        return true;
    }

    public final void a(String s, byte byte0)
    {
        if(byte0 == 0)
        {
            a.a(s, "subscribed", null, null, 0);
            a.a(s, null, null, null);
            a.a(s, "subscribe", null, null, 0);
            return;
        }
        if(byte0 == 1)
        {
            a.a(s, "subscribed", null, null, 0);
            return;
        }
        if(byte0 == 2)
            a.a(s, "unsubscribed", null, null, 0);
    }

    public final void a(String s, Vector vector, short aword0[])
    {
        a.a(s, vector, aword0);
    }

    public final boolean b(String s, String s1, String s2, String s3)
    {
        String s4 = null;
        if(pica.ui.f.b(s) || !s.equals(a().b))
            s4 = "\u5BC6\u7801\u4E0D\u6B63\u786E\u3002";
        else
        if(s1 != null && pica.ui.f.a(s1))
            s4 = "\u5F53\u524D\u624B\u673A\u53F7\u4E0D\u6B63\u786E\u3002";
        else
        if(pica.ui.f.a(s2))
            s4 = "\u65B0\u7684\u624B\u673A\u53F7\u4E0D\u6B63\u786E\u3002";
        else
        if(pica.ui.f.a(s3) || !s2.equals(s3))
            s4 = "\u65B0\u624B\u673A\u53F7\u4E0E\u786E\u8BA4\u624B\u673A\u53F7\u4E0D\u4E00\u81F4\u3002";
        if(s4 != null)
        {
            a(0, s4);
            return false;
        } else
        {
            a.b(a().a, s, s1, s2);
            return true;
        }
    }

    public final boolean g(String s, String s1, String s2)
    {
        String s3 = null;
        if(s1 != null && pica.ui.f.a(s1))
            s3 = "\u624B\u673A\u53F7\u683C\u5F0F\u4E0D\u6B63\u786E\u3002";
        else
        if(s.length() == 0)
        {
            s3 = "\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A\u3002";
        } else
        {
            int i1 = s.length();
            int j1 = 0;
            do
            {
                if(j1 >= i1)
                    break;
                char c1;
                if(((c1 = s.charAt(j1)) < '0' || c1 > '9') && (c1 < 'A' || c1 > 'Z') && (c1 < 'a' || c1 > 'z') && c1 != '_')
                {
                    s3 = "\u8F93\u5165\u7684\u5BC6\u7801\u6709\u975E\u6CD5\u5B57\u7B26\u3002";
                    break;
                }
                j1++;
            } while(true);
        }
        if(s3 != null)
        {
            a(0, s3);
            return false;
        }
        if(a == null)
            a = new g(this);
        a.e(s, s1, s2);
        return true;
    }

    public final void m()
    {
        c.y().a();
        c.q().a();
        c.o().a();
        c.l().a();
        c.m().a();
    }

    public final void n()
    {
        a.h();
        a = null;
    }

    public final void o()
    {
        if(a != null)
            a.a();
    }

    public final void p()
    {
        RecordStore recordstore = null;
        String s = "Account";
        try
        {
            RecordStore.deleteRecordStore(s);
        }
        catch(Exception _ex) { }
        recordstore = RecordStore.openRecordStore(s, true);
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        DataOutputStream dataoutputstream;
        (dataoutputstream = new DataOutputStream(bytearrayoutputstream)).writeUTF(c.a);
        dataoutputstream.writeUTF(c.b);
        dataoutputstream.writeBoolean(c.e);
        dataoutputstream.writeBoolean(c.f);
        dataoutputstream.writeBoolean(c.g);
        dataoutputstream.writeBoolean(c.h);
        dataoutputstream.writeByte(c.j);
        dataoutputstream.writeByte(c.i);
        byte abyte0[] = bytearrayoutputstream.toByteArray();
        recordstore.addRecord(abyte0, 0, abyte0.length);
        recordstore.closeRecordStore();
        return;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
        if(recordstore != null)
            try
            {
                recordstore.closeRecordStore();
                return;
            }
            catch(Exception _ex) { }
        return;
    }

    public final void q()
    {
        RecordStore recordstore = null;
        String s;
        recordstore = RecordStore.openRecordStore(s = "Account", false);
        DataInputStream datainputstream = new DataInputStream(new ByteArrayInputStream(recordstore.getRecord(1)));
        c.a = datainputstream.readUTF();
        c.b = datainputstream.readUTF();
        c.e = datainputstream.readBoolean();
        c.f = datainputstream.readBoolean();
        c.g = datainputstream.readBoolean();
        c.h = datainputstream.readBoolean();
        c.j = datainputstream.readByte();
        c.i = datainputstream.readByte();
        recordstore.closeRecordStore();
        return;
        JVM INSTR dup ;
        Exception exception;
        exception;
        printStackTrace();
        if(recordstore != null)
            try
            {
                recordstore.closeRecordStore();
            }
            catch(Exception _ex) { }
        c.a = "";
        c.b = "";
        c.e = false;
        c.f = false;
        c.g = false;
        c.h = false;
        c.j = 0;
        c.i = 3;
        return;
    }

    private c b;
    public g a;
    private b c;
}
